]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
appDisplay: Use new moveItem API to move items
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Wed, 23 Sep 2020 19:53:17 +0000 (16:53 -0300)
committerFlorian Müllner <florian.muellner@gmail.com>
Mon, 5 Oct 2020 12:06:47 +0000 (12:06 +0000)
This uses the API added in the previous commit. The intent here
is to avoid removing and readding actors when moving them around.

Related: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3165

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1447

js/ui/appDisplay.js

index 9094fcf0388a1deab89004bbd2f34b1819337d8c..3f2f6054296015a2cd72b946e6ee37965e509923 100644 (file)
@@ -746,10 +746,14 @@ var BaseAppView = GObject.registerClass({
         if (page === newPage && position === newPosition)
             return;
 
-        if (page !== -1 && position !== -1)
-            this._removeItem(item);
+        // Update the _orderedItems array
+        let index = this._orderedItems.indexOf(item);
+        this._orderedItems.splice(index, 1);
 
-        this._addItem(item, newPage, newPosition);
+        index = this._getLinearPosition(newPage, newPosition);
+        this._orderedItems.splice(index, 0, item);
+
+        this._grid.moveItem(item, newPage, newPosition);
     }
 
     vfunc_allocate(box) {